export function sum(a, b) {
  return a + b;
}

//获取对象
export const getUserInfo=()=>{
  return{name:"heimao",age:'20'};
}

//获取字符串或者数字的长度
export const getintArray=(args)=>{
  try{
    return args.split("");
  }catch(e){
    console.error(e);
  } 
}

//测试是否会抛出异常
export const testThrow=args=>{
  if(args==0) throw new Error("参数不能为0")
  else return args;
}


//测试异步情况
export const getRoute=()=>{
  return new Promise(resolve=>{
    setTimeout(()=>{
      resolve({
        name:"heimao",
        hide:false,
      });
    },2000) 
  })
}

